var app = getApp();
var ajax = require('../../utils/ajax.js');

Page({
    data: {
        dataLoaded:false,
        userInfo: {},
        shareImg:''
    },
    /**
     * 分享
     */
    onShareAppMessage: function() {
        return {
            title: '【' + this.data.userInfo.nickName + '】邀请您加入分销',
            path: "pages/applyFx/applyFx?recommend=" + this._userId,
            success: function(res) {

            }
        }
    },
    /**
     * 页面加载
     */
    onLoad: function(options) {
        var _self = this;

        app.getUserInfo(function(userInfo) {
            _self.setData({
                userInfo: userInfo,
            });
            _self.getShareImg();
        })

        this._userId = app.getUserId();
    },
    getShareImg(){
        var url = '/openapi/CHome/fxInvite';
        ajax.G(url,{},(data)=>{
            this.setData({
                shareImg:data.result.fx_img_url,
                dataLoaded:true
            })
        })
    }
    // shareInfo: function() {
    //     var _self = this;
    //     ajax.G('/openapi/CHome/fxInvite', {
    //         recommend: objData.recommend
    //     }, function(data) {})
    // },
})